var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function() {
        var t = function(e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({ __proto__: [] }
                    instanceof Array &&
                    function(t, e) {
                        t.__proto__ = e;
                    }) ||
                function(t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function(e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })(),
    r =
    (this && this.__decorate) ||
    function(t, e, o, n) {
        var r,
            a = arguments.length,
            i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
        else
            for (var s = t.length - 1; s >= 0; s--)
                (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
        return a > 3 && i && Object.defineProperty(e, o, i), i;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = t("EventData"),
    i = t("GameData"),
    s = t("main"),
    c = t("Util"),
    l = t("enemyMangaer"),
    u = t("friend"),
    p = t("player"),
    f = t("bombBoxManager"),
    d = t("buildManager"),
    h = t("dotValueManager"),
    y = t("fail"),
    g = t("flyBoxManager"),
    v = t("victory"),
    m = t("fightView"),
    _ = require("./震屏"),
    A = cc._decorator,
    b = A.ccclass,
    C = A.property,
    w = (function(t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (
                (e.camera = null),
                (e.zp = null),
                (e.所有人的分数和状态 = new a.default([])),
                (e.能否复活 = !0),
                (e.speed = new a.default(1)),
                (e.bg = null),
                (e.bodys = null),
                (e.player = null),
                (e.helpPlayer = null),
                (e.enemy = null),
                (e.bombBox = null),
                (e.dotValue = null),
                (e.flybox = null),
                (e.build = null),
                e
            );
        }
        var o;
        return (
            n(e, t),
            (o = e),
            (e.prototype.分数和状态变化 = function(t, e) {
                o.ispvp &&
                    ((t.c.num += e),
                        this.所有人的分数和状态.value.sort(function(t, e) {
                            return e.num - t.num;
                        }),
                        this.所有人的分数和状态.emit());
            }),
            (e.prototype.消灭敌人胜利 = function() {
                cc.find("Canvas/View").getComponent(m.default).showView(v.default),
                    o.fubendata &&
                    !i.default.fubens.includes(o.fubendata.ID) &&
                    (i.default.fubens.push(o.fubendata.ID), (i.default.fubens = i.default.fubens));
            }),
            (e.prototype.玩家死亡失败 = function() {
                cc.find("Canvas/View").getComponent(m.default).showView(y.default);
            }),
            (e.prototype.复活 = function() {
                (this.能否复活 = !1), this.player.复活(), (this.player.box.enabled = !0), (this.speed.value = 1);
            }),
            (e.gamedt = function(t) {
                return this.inst.speed.value * t;
            }),
            (e.prototype.onEnable = function() {
                (o.inst = this), (o.g = cc.Canvas.instance.getComponent(s.default).重力速度), (this.speed.value = 1);
            }),
            (e.prototype.onDisable = function() {
                (o.inst = null), (this.points = null);
            }),
            (e.prototype.get_nearest_enemy = function(t) {
                throw new Error("Method not implemented.");
            }),
            (e.prototype.on_player_attack = function() {
                this.player.on_attack();
            }),
            (e.prototype.on_player_skill = function(t) {
                this.player.on_skill(t);
            }),
            (e.prototype.get_random_birth_point = function() {
                if ((null == this.points && this.init_birth_point(), 0 == this.points.length))
                    throw (cc.log(o.mapdata), new Error("出生点不够"));
                if (1 == this.points.length) {
                    var t = this.points[0];
                    return (this.points.length = 0), t;
                }
                var e = c.RandomInt(0, this.points.length - 1),
                    n = this.points[e];
                return this.points.splice(e, 1), n;
            }),
            (e.prototype.init_birth_point = function() {
                var t = o.mapdata;
                this.points = [];
                for (var e = 0; e < t.chusheng.length; e += 2) {
                    var n = [t.chusheng[e], t.chusheng[e + 1]];
                    this.points.push(n);
                }
            }),
            (e.prototype.TelepoleEvent = function(t) {
                t ? this.player.onTelepoleMove(t) : this.player.onTelepoleStop();
            }),
            (e.进入时间 = Date.now()),
            r([C(cc.Camera)], e.prototype, "camera", void 0),
            r([C(_.default)], e.prototype, "zp", void 0),
            r([C(cc.Node)], e.prototype, "bg", void 0),
            r([C(cc.Node)], e.prototype, "bodys", void 0),
            r([C(p.default)], e.prototype, "player", void 0),
            r([C(u.default)], e.prototype, "helpPlayer", void 0),
            r([C(l.default)], e.prototype, "enemy", void 0),
            r([C(f.default)], e.prototype, "bombBox", void 0),
            r([C(h.default)], e.prototype, "dotValue", void 0),
            r([C(g.default)], e.prototype, "flybox", void 0),
            r([C(d.default)], e.prototype, "build", void 0),
            (e = o = r([b], e))
        );
    })(cc.Component);
o.default = w;